afcd3cac9fc69de2185bde7d80536cdf9aee4d91,src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java,SplatterBallBrush,splatterBall,#SnipeData#Location#,56

Before Change



        for (int r = 0; r < this.splatterRecursions; r++) {
            double grow = this.growPercent - ((this.growPercent / this.splatterRecursions) * (r));
            for (int x = 2 * size; x >= 0; x--) {
                for (int y = 2 * size; y >= 0; y--) {
                    for (int z = 2 * size; z >= 0; z--) {
                        tempSplat[x][y][z] = splat[x][y][z]; // prime tempsplat

                        growcheck = 0;
                        if (splat[x][y][z] == 0) {
                            if (x != 0 && splat[x - 1][y][z] == 1) {
                                growcheck++;
                            }
                            if (y != 0 && splat[x][y - 1][z] == 1) {
                                growcheck++;
                            }
                            if (z != 0 && splat[x][y][z - 1] == 1) {
                                growcheck++;
                            }
                            if (x != 2 * v.getBrushSize() && splat[x + 1][y][z] == 1) {
                                growcheck++;
                            }
                            if (y != 2 * v.getBrushSize() && splat[x][y + 1][z] == 1) {
                                growcheck++;
                            }
                            if (z != 2 * v.getBrushSize() && splat[x][y][z + 1] == 1) {

After Change


        this.setName("Splatter Ball");
    }

    private void splatterBall(final SnipeData v, Location<World> targetBlock) {
        int size = (int) Math.round(v.getBrushSize());
        final boolean[][][] splat = new boolean[2 * size][2 * size][2 * size];

        // @Cleanup: a 3d bitset would make this a lot smaller in memory
        // footprint

        // Seed the array
        for (int x = 2 * size; x >= 0; x--) {
            for (int y = 2 * size; y >= 0; y--) {
                for (int z = 2 * size; z >= 0; z--) {
                    if (this.generator.nextDouble() <= this.seedPercent) {
                        splat[x][y][z] = true;
                    }
                }
            }
        }
        // Grow the seeds
        final boolean[][][] tempSplat = new boolean[2 * size][2 * size][2 * size];
        int growcheck;

        for (int r = 0; r < this.splatterRecursions; r++) {
            double grow = this.growPercent - ((this.growPercent / this.splatterRecursions) * (r));
            for (int x = 2 * size; x >= 0; x--) {
                for (int y = 2 * size; y >= 0; y--) {
                    for (int z = 2 * size; z >= 0; z--) {
                        tempSplat[x][y][z] = splat[x][y][z]; // prime tempsplat

                        growcheck = 0;
                        if (!splat[x][y][z]) {
                            if (x != 0 && splat[x - 1][y][z]) {
                                growcheck++;
                            }
                            if (y != 0 && splat[x][y - 1][z]) {
                                growcheck++;
                            }
                            if (z != 0 && splat[x][y][z - 1]) {
                                growcheck++;
                            }
                            if (x != 2 * size && splat[x + 1][y][z]) {
                                growcheck++;
                            }
                            if (y != 2 * size && splat[x][y + 1][z]) {
                                growcheck++;
                            }
                            if (z != 2 * size && splat[x][y][z + 1]) {
                                growcheck++;
                            }
                        }

                        if (growcheck >= 0 && this.generator.nextDouble() <= grow) {
                            tempSplat[x][y][z] = true;
                        }

                    }
                }
            }
            // integrate tempsplat back into splat at end of iteration
            for (int x = 2 * size; x >= 0; x--) {
                for (int y = 2 * size; y >= 0; y--) {
                    for (int z = 2 * size; z >= 0; z--) {
                        splat[x][y][z] = tempSplat[x][y][z];
                    }
                }
            }
        }
        // Fill 1x1x1 holes
        for (int x = 2 * size - 2; x >= 1; x--) {
            for (int y = 2 * size - 2; y >= 1; y--) {
                for (int z = 2 * size - 2; z >= 1; z--) {
                    if (splat[x - 1][y][z] && splat[x + 1][y][z] && splat[x][y - 1][z] && splat[x][y + 1][z] && splat[x][y][z - 1]
                            && splat[x][y][z + 1]) {
                        splat[x][y][z] = true;
                    }
                }
            }
        }

        this.undo = new Undo(GenericMath.floor(4 * Math.PI * (v.getBrushSize() + 1) * (v.getBrushSize() + 1) * (v.getBrushSize() + 1) / 3));
        // Make the changes
        final double rSquared = v.getBrushSize() * v.getBrushSize();